package com.maezia.tdr.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.maezia.tdr.domain.po.RequestLog;
import com.maezia.tdr.service.RedisMessageService;
import com.maezia.tdr.service.RequestLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class LoggingPocessingServiceImpl implements RedisMessageService {

    @Autowired
    private RequestLogService requestLogService;

    @Override
    public void pocessing(String message) {
        try {
            RequestLog requestLog = JSONObject.parseObject(message, RequestLog.class);
            requestLogService.save(requestLog);
        }catch (Exception e){
            log.error("Exception", e);
        }
    }
}
